package cn.liubanglong.i18n.service.impl;

import cn.liubanglong.i18n.orm.dao.TestDao;
import cn.liubanglong.i18n.orm.entity.TestEntity;
import cn.liubanglong.i18n.service.TestService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author liubanglong
 * @since 2025-01-09
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class TestServiceImpl implements TestService {
    private final TestDao testDao;

    @Override
    public void add() {
        Date now = new Date();
        TestEntity entity = TestEntity.builder().dateField(now).dateTimeField(now).timestampField(now).build();
        testDao.save(entity);
        log.info("数据添加成功");
    }

    @Override
    public List<TestEntity> list() {
        return testDao.list();
    }
}
